package com.sgl.service;

import com.sgl.dao.DictMapper;
import com.sgl.entity.Dict;
import com.sgl.util.PageBean;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DictService {
    @Autowired
    DictMapper dictMapper;

    public Dict findByKeywords(String key){
        return  dictMapper.findByKey(key);
    }

   public List<Dict> findList(PageBean<Dict> pageBean){
        List<Dict> list = dictMapper.findList(pageBean);
        return list;
    }

    public  Integer countList(PageBean<Dict> pageBean){
        Integer integer = dictMapper.countList(pageBean);
        return integer;
    }

    public Integer insert(Dict dict){
        Integer insert = dictMapper.insert(dict);
        return insert;
    }

    public Integer update(Dict dict){
        Integer update = dictMapper.update(dict);
        return update;
    }

    public Integer delete(@Param("ids") List<String> ids){
        Integer delete = dictMapper.delete(ids);
        return delete;
    }

    public Dict findByKey(String key){
        return dictMapper.findByKey(key);
    }
}
